
/* NOTE: 
   This version: 
   - uses the "in" variables from the m_psid.do file, so the accuracy variables are filled in for ALL individuals (not just HEAD/WIFE)
   - uses 0 (instead of missing) as base value
 */

**************************** 
*** FLAG NON-IMPUTED VALUES

*Create empty "good" income flags (use "S_" for keeping in "sample"; 0/1 for incomes that are NOT imputed by major assignment)
forv i=1/$NW {
foreach var in inc {
  qui gen byte S_`var'hd`i'=0	if `var'hd`i'!=.	// HEAD labor income not imputed
  qui gen byte S_`var'wf`i'=0	if `var'wf`i'!=.	// WIFE labor income not imputed
  qui gen byte S_bus`var'`i'=0	if (earnbushd`i'!=. | earnbuswf`i'!=.)	// business income not imputed
  qui gen byte S_frm`var'`i'=0	if farm`var'`i'!=.	// farm income not imputed
  qui gen byte S_nonlab`var'`i'=0 if fminc`i'!=.	// NON-LABOR (family) income
  qui gen byte S_hourshd`i'=0	if hourshd`i'!=.	// HEAD labor income not imputed
  qui gen byte S_hourswf`i'=0	if hourswf`i'!=.	// WIFE labor income not imputed  
  label var S_`var'hd`i' 	 	"HEAD Labor income NOT imputed by major assignment"
  label var S_`var'wf`i' 		"WIFE Labor income NOT imputed by major assignment"
  label var S_bus`var'`i' 		"BUSINESS income NOT imputed by major assignment (1994-2017)"
  label var S_frm`var'`i' 		"FARM income NOT imputed by major assignment (1994-2017)"
  label var S_nonlab`var'`i' 	"(Family) NON-LABOR income NOT imputed by major assignment"
  label var S_hourshd`i'		"HEAD hours NOT imputed by major assignment"
  label var S_hourswf`i'		"WIFE hours NOT imputed by major assignment"
}
}

*LABOR INCOME (pre-tax)
foreach var in inc {

*1968-1975 Surveys (0=No assignment; 1=Minor assignment; 2=Major assignment (probably error of >$300 OR 10% of assignment value, whichever is greater))
forv i=1/8 {
  replace S_`var'hd`i'=1  	if inlist(accearntotin`i',0,1) 		// head income
  replace S_`var'wf`i'=1  	if inlist(accearntotwfin`i',0,1) 	// wife income			
  }
*1976-1992 (0=No assignment, 1=Minor assignment; 2=Major assignment) [Now two accuracy vars for head's labor income: accearnoth=>non-wage income included in labor total, accearnwage=>wage/salary income]
forv i=9/25 {
  replace S_`var'hd`i'=1  	if inlist(accearnothin`i',0,1) 	& inlist(accearnwagein`i',0,1)
  replace S_`var'wf`i'=1    if inlist(accearntotwfin`i',0,1)								  
  }
*1993 (no distinction between major/minor imputed; only indicator for imputed) 
forv i=26/26 {
  replace S_`var'hd`i'=1    if inlist(accearnwagein`i',0) & inlist(accbnsin`i',0) & inlist(accotmin`i',0) & inlist(acctipin`i',0) & inlist(acccomin`i',0) & inlist(accprfin`i',0) & inlist(accmkgin`i',0) & inlist(accxtrin`i',0) & inlist(accothin`i',0) & inlist(accbusin`i',0)
  replace S_`var'wf`i'=1    if inlist(accearntotwfin`i',0)								  
  }
*1994-1996 (0=No assignment, 1=Imputed by PSID staff during data cleaning and editing, 2=Imputed from other info in this interview, 3=Imputed from last wave's report for this case, 4=Imputed from subgroup means, 5=Imputed using median value for all non-zero cases)
			*Note: some wild codes or other values higher than 5 in some years, but doesn't matter for the way this code is written
			*Need to add labor part of business income for comparability across years
			*Farm income (and income from commission) : 1=Imputed by PSID staff during data cleaning and editing, 2=median value (but so is category 4 so likely a typo. PSID never answered this question.)
			*Farm income: is Head AND Wife's farm income (not separable), also includes asset AND labor income
			*1994: one-time spike in accearntotwf=4 (>500 obs) assigned with tables of subgroup means
forv i=27/29 {
  replace S_`var'hd`i'=1    if inlist(accearnwagein`i',0,1,2,3) & inlist(accbnsin`i',0,1,2,3) & inlist(accotmin`i',0,1,2,3) & inlist(acctipin`i',0,1,2,3) & inlist(acccomin`i',0,1,2,3) & inlist(accprfin`i',0,1,2,3) & inlist(accmkgin`i',0,1,2,3) & inlist(accxtrin`i',0,1,2,3) & inlist(accothin`i',0,1,2,3) 
  replace S_`var'wf`i'=1    if inlist(accearntotwfin`i',0,1,2,3)	 
  replace S_bus`var'`i'=1 	if inlist(accbusin`i',0,1,2,3)							  
  replace S_frm`var'`i'=1 	if inlist(accfrmin`i',0,1,2,3)	// see note above						  
  }
*1997, 1999 (same as above, except accbusin`i', accfrmin and accearntotwf=0/1 imputed indicator)
* Need to add labor part of business income for comparability across years
forv i=30/31 {
  replace S_`var'hd`i'=1    if inlist(accearnwagein`i',0,1,2,3) & inlist(accbnsin`i',0,1,2,3) & inlist(accotmin`i',0,1,2,3) & inlist(acctipin`i',0,1,2,3) & inlist(acccomin`i',0,1,2,3) & inlist(accprfin`i',0,1,2,3) & inlist(accmkgin`i',0,1,2,3) & inlist(accxtrin`i',0,1,2,3) & inlist(accothin`i',0,1,2,3) 
  replace S_`var'wf`i'=1    if inlist(accearntotwfin`i',0)	
  replace S_bus`var'`i'=1 	if  inlist(accbusin`i',0)						  
  replace S_frm`var'`i'=1 	if  inlist(accfrmin`i',0)						  
  }
*2001 (same as 1994-1996, except accxtr=0/1 imputed with 2,3=wild code)
* Need to add labor part of business income for comparability across years
forv i=32/32 {
  replace S_`var'hd`i'=1    if inlist(accearnwagein`i',0,1,2,3) & inlist(accbnsin`i',0,1,2,3) & inlist(accotmin`i',0,1,2,3) & inlist(acctipin`i',0,1,2,3) & inlist(acccomin`i',0,1,2,3) & inlist(accprfin`i',0,1,2,3) & inlist(accmkgin`i',0,1,2,3) & inlist(accxtrin`i',0) & inlist(accothin`i',0,1,2,3) 
  replace S_`var'wf`i'=1    if inlist(accearntotwfin`i',0)						  
  replace S_bus`var'`i'=1 	if  inlist(accbusin`i',0,1,2,3)						  
  replace S_frm`var'`i'=1 	if  inlist(accfrmin`i',0,1,2,3)	
  }
*2003-2013 (same value meanings as above)
* Need to add labor part of business income for comparability across years
* Farm income acc values now fixed so 2=Imputed from other info in this interview
forv i=33/38 {
  replace S_`var'hd`i'=1    if inlist(accearnwagein`i',0,1,2,3) & inlist(accbnsin`i',0,1,2,3) & inlist(accotmin`i',0,1,2,3) & inlist(acctipin`i',0,1,2,3) & inlist(acccomin`i',0,1,2,3) & inlist(accprfin`i',0,1,2,3) & inlist(accmkgin`i',0,1,2,3) & inlist(accxtrin`i',0,1,2,3) & inlist(accothin`i',0,1,2,3) 
  replace S_`var'wf`i'=1    if inlist(accearntotwfin`i',0)	
  replace S_bus`var'`i'=1 	if  inlist(accbusin`i',0,1,2,3)						  
  replace S_frm`var'`i'=1 	if  inlist(accfrmin`i',0,1,2,3)	
  }  
*2015-2017 (same value meanings, but no market gardening income variable any longer so no accuracy code for this; also have accuracy broken down for separate categories for "wife" income, mirroring codes for "head" income categories)
* Need to add labor part of business income for comparability across years
forv i=39/41 {
  replace S_`var'hd`i'=1    if inlist(accearnwagein`i',0,1,2,3) & inlist(accbnsin`i',0,1,2,3) & inlist(accotmin`i',0,1,2,3) & inlist(acctipin`i',0,1,2,3) & inlist(acccomin`i',0,1,2,3) & inlist(accprfin`i',0,1,2,3) & inlist(accxtrin`i',0,1,2,3) & inlist(accothin`i',0,1,2,3) 
  replace S_`var'wf`i'=1    if inlist(accearnwagewfin`i',0,1,2,3) & inlist(accbnswfin`i',0,1,2,3) & inlist(accotmwfin`i',0,1,2,3) & inlist(acctipwfin`i',0,1,2,3) & inlist(acccomwfin`i',0,1,2,3) & inlist(accprfwfin`i',0,1,2,3) & inlist(accxtrwfin`i',0,1,2,3) & inlist(accothwfin`i',0,1,2,3)   
  replace S_bus`var'`i'=1 	if  inlist(accbusin`i',0,1,2,3)						  
  replace S_frm`var'`i'=1 	if  inlist(accfrmin`i',0,1,2,3)	
  }
} // end LABOR INCOME














*** NON-LABOR INCOME

foreach var in inc {

*1968 survey (0=No assignment; 1=Minor assignment; 2=Major assignment; plus some variables have 5=estimate not accurate reflection of income or payments in 1967 (e.g., mortgage or married in 1968))	
forv i=1/1 {		
  replace S_nonlab`var'`i'=1 if inlist(accassetinchwin`i',0,1) & inlist(acctransfhwin`i',0,1) & inlist(acctxincothin`i',0,1) 
}
*1969-1986 (0=No assignment; 1=Minor assignment; 2=Major assignment)
forv i=2/19 {
  replace S_nonlab`var'`i'=1 if inlist(accassetinchwin`i',0,1) & inlist(acctransfhwin`i',0,1) & inlist(acctxincothin`i',0,1) & inlist(acctransfothin`i',0,1) & inlist(accadcin`i',0,1) 
}	
*1987-1992 (same codes, just ADC acc separate for H/W now)
forv i=20/25 {
  replace S_nonlab`var'`i'=1 if inlist(accassetinchwin`i',0,1) & inlist(acctransfhwin`i',0,1) & inlist(acctxincothin`i',0,1) & inlist(acctransfothin`i',0,1) & inlist(accadchdin`i',0,1) & inlist(accadcwfin`i',0,1) 
}
*1993
forv i=26/26 {
  replace S_nonlab`var'`i'=1  if inlist(accofummisctr`i',0)  & inlist(acctrustwf`i',0) & inlist(accintwf`i',0) & inlist(accdivwf`i',0) & inlist(accalimhd`i',0) & inlist(acctrusthd`i',0) & inlist(accinthd`i',0) & inlist(accdividhd`i',0) & inlist(accrenthd`i',0) & inlist(acctnsfmiscwf`i',0) & inlist(acchlpnonrelwf`i',0) & inlist(acchlprelwf`i',0) & inlist(accpenswf`i',0) & inlist(accsswf`i',0) & inlist(accothwelwf`i',0) & inlist(accchsuppwf`i',0) & inlist(accssiwf`i',0) & inlist(accwrkcomwf`i',0) & inlist(accunempwf`i',0) & inlist(acctnsfmischd`i',0)  & inlist(acchlprelhd`i',0) & inlist(accchsupphd`i',0) & inlist(accwrkcomhd`i',0) & inlist(accunemphd`i',0) & inlist(accotrethd`i',0) & inlist(accirahd`i',0) & inlist(accpenshd`i',0) & inlist(accvapenshd`i',0) & inlist(accsshd`i',0) & 	 inlist(accothwelhd`i',0) & inlist(accssihd`i',0)  & inlist(accearntotofum`i',0) & inlist(accadcofum`i',0) & inlist(accssiofum`i',0) & inlist(accofumwelf`i',0) & inlist(accofumss`i',0) & inlist(accofumva`i',0) & inlist(accofumret`i',0) & inlist(accofumunemp`i',0) & inlist(accofumwrkcmp`i',0) & inlist(accofumchsupp`i',0) & inlist(accofumhlprel`i',0) & inlist(accadchdin`i',0) & inlist(accadcwfin`i',0)  
}
*1994-1996 (27/29) NO ACCURACY VARIABLES AVAILABLE
forv i=27/29 {
  replace S_nonlab`var'`i'=1 
}
*1997,1999 
forv i=30/31 {
  replace S_nonlab`var'`i'=1 if inlist(accassetinchwin`i',0) & inlist(acctransfhwin`i',0) & inlist(acctxincothin`i',0) & inlist(acctransfothin`i',0) & inlist(accfamssi`i',0) 
}
*2001
forv i=32/32 {
  replace S_nonlab`var'`i'=1  if  inlist(acctrustwf`i',0) & inlist(accintwf`i',0) & inlist(accdivwf`i',0) & inlist(accalimhd`i',0) & inlist(acctrusthd`i',0) & inlist(accinthd`i',0) & inlist(accdividhd`i',0) & inlist(accrenthd`i',0) & inlist(acctnsfmiscwf`i',0) & inlist(acchlpnonrelwf`i',0) & inlist(acchlprelwf`i',0) & inlist(accpenswf`i',0)  & inlist(accothwelwf`i',0) & inlist(accchsuppwf`i',0) & inlist(accssiwf`i',0) & inlist(accwrkcomwf`i',0) & inlist(accunempwf`i',0) & inlist(acctnsfmischd`i',0)  & inlist(acchlprelhd`i',0) & inlist(accchsupphd`i',0) & inlist(accunemphd`i',0) & inlist(accirahd`i',0) & inlist(accpenshd`i',0) & inlist(accvapenshd`i',0) & inlist(accothwelhd`i',0) & inlist(accssihd`i',0)  & inlist(accadchdin`i',0) & inlist(accadcwfin`i',0)  & inlist(accwfothasset`i',0)  	
}

*2003
forv i=33/33 {
  replace S_nonlab`var'`i'=1  if inlist(acctrustwf`i',0) & inlist(accintwf`i',0) & inlist(accdivwf`i',0) & inlist(accalimhd`i',0) & inlist(acctrusthd`i',0) & inlist(accinthd`i',0) & inlist(accdividhd`i',0) & inlist(accrenthd`i',0)  & inlist(acchlpnonrelwf`i',0) & inlist(acchlprelwf`i',0) & inlist(accpenswf`i',0) & inlist(accothwelwf`i',0) & inlist(accchsuppwf`i',0) & inlist(accssiwf`i',0) & inlist(accwrkcomwf`i',0) & inlist(accunempwf`i',0)  & inlist(acchlprelhd`i',0) & inlist(accchsupphd`i',0) & inlist(accwrkcomhd`i',0) & inlist(accunemphd`i',0) & inlist(accotrethd`i',0) & inlist(accirahd`i',0) & inlist(accpenshd`i',0) & inlist(accvapenshd`i',0) & inlist(accothwelhd`i',0) & inlist(accssihd`i',0)  & inlist(accadchdin`i',0) & inlist(accadcwfin`i',0) & inlist(acchdhlelse`i',0) & inlist(accwfrent`i',0) & inlist(accwfother`i',0)  	
}	
//  OFUM vars not actually populated in wave 33	
*2005
forv i=34/34 {
  replace S_nonlab`var'`i'=1  if inlist(accofummisctr`i',0)  & inlist(acctrustwf`i',0) & inlist(accintwf`i',0) & inlist(accdivwf`i',0) & inlist(accalimhd`i',0) & inlist(acctrusthd`i',0) & inlist(accinthd`i',0) & inlist(accdividhd`i',0) & inlist(accrenthd`i',0) & inlist(acctnsfmiscwf`i',0) & inlist(acchlpnonrelwf`i',0) & inlist(acchlprelwf`i',0) & inlist(accpenswf`i',0)  & inlist(accothwelwf`i',0) & inlist(accchsuppwf`i',0) & inlist(accssiwf`i',0) & inlist(accwrkcomwf`i',0) & inlist(accunempwf`i',0) & inlist(acctnsfmischd`i',0)  & inlist(acchlprelhd`i',0) & inlist(accchsupphd`i',0)  &  inlist(accwrkcomhd`i',0) & inlist(accunemphd`i',0) & inlist(accotrethd`i',0) & inlist(accirahd`i',0) & inlist(accpenshd`i',0) & inlist(accvapenshd`i',0)  &  inlist(accothwelhd`i',0) & inlist(accssihd`i',0)  & inlist(accssiofum`i',0) & inlist(accofumwelf`i',0) & inlist(accofumss`i',0) & inlist(accofumva`i',0) & inlist(accofumret`i',0) & inlist(accofumunemp`i',0) & inlist(accofumwrkcmp`i',0) & inlist(accofumchsupp`i',0) & inlist(accofumhlprel`i',0) & inlist(accadchdin`i',0) & inlist(accadcwfin`i',0) & inlist(acchdhlelse`i',0) & inlist(accwfrent`i',0) & inlist(accwfother`i',0) & inlist(accsswf`i',0) & inlist(accsshd`i',0) & inlist(accadcofum`i',0) 
}
*2007,2009,2011
forv i=35/37 {
  replace S_nonlab`var'`i'=1  if inlist(accofummisctr`i',0)  & inlist(acctrustwf`i',0) & inlist(accintwf`i',0) & inlist(accdivwf`i',0) & inlist(accalimhd`i',0) & inlist(acctrusthd`i',0) & inlist(accinthd`i',0) & inlist(accdividhd`i',0) & inlist(accrenthd`i',0) & inlist(acctnsfmiscwf`i',0) & inlist(acchlpnonrelwf`i',0) & inlist(acchlprelwf`i',0) & inlist(accpenswf`i',0) & inlist(accsswf`i',0) & inlist(accothwelwf`i',0) & inlist(accchsuppwf`i',0) & inlist(accssiwf`i',0) & inlist(accwrkcomwf`i',0) & inlist(accunempwf`i',0) & inlist(acctnsfmischd`i',0)  & inlist(acchlprelhd`i',0) & inlist(accchsupphd`i',0) & inlist(accwrkcomhd`i',0) & inlist(accunemphd`i',0) & inlist(accotrethd`i',0) & inlist(accirahd`i',0) & inlist(accpenshd`i',0) & inlist(accvapenshd`i',0) & inlist(accsshd`i',0) & 	 inlist(accothwelhd`i',0) & inlist(accssihd`i',0)  & inlist(accssiofum`i',0) & inlist(accofumwelf`i',0) & inlist(accofumss`i',0) & inlist(accofumva`i',0) & inlist(accofumret`i',0) & inlist(accofumunemp`i',0) & inlist(accofumwrkcmp`i',0) & inlist(accofumchsupp`i',0) & inlist(accofumhlprel`i',0) & inlist(accadchdin`i',0) & inlist(accadcwfin`i',0) & inlist(acchdhlelse`i',0) & inlist(accwfrent`i',0) & inlist(accwfother`i',0)  	
}
*2013
forv i=38/38 {
  replace S_nonlab`var'`i'=1  if inlist(accofummisctr`i',0)  & inlist(acctrustwf`i',0) & inlist(accintwf`i',0) & inlist(accdivwf`i',0) & inlist(accalimhd`i',0) & inlist(acctrusthd`i',0) & inlist(accinthd`i',0) & inlist(accdividhd`i',0) & inlist(accrenthd`i',0) & inlist(acctnsfmiscwf`i',0) & inlist(acchlpnonrelwf`i',0) & inlist(acchlprelwf`i',0) & inlist(accpenswf`i',0) & inlist(accsswf`i',0) & inlist(accothwelwf`i',0) & inlist(accchsuppwf`i',0) & inlist(accssiwf`i',0) & inlist(accwrkcomwf`i',0) & inlist(accunempwf`i',0) & inlist(acctnsfmischd`i',0)  & inlist(acchlprelhd`i',0) & inlist(accchsupphd`i',0) & inlist(accwrkcomhd`i',0) & inlist(accunemphd`i',0) & inlist(accotrethd`i',0) & inlist(accirahd`i',0) & inlist(accpenshd`i',0) & inlist(accvapenshd`i',0) & inlist(accsshd`i',0) & 	 inlist(accothwelhd`i',0) & inlist(accssihd`i',0)  & inlist(accssiofum`i',0) & inlist(accofumss`i',0) & inlist(accofumva`i',0) & inlist(accofumret`i',0) & inlist(accofumunemp`i',0) & inlist(accofumwrkcmp`i',0) & inlist(accofumchsupp`i',0) & inlist(accofumhlprel`i',0) & inlist(accadchdin`i',0) & inlist(accadcwfin`i',0) & inlist(acchdhlelse`i',0) & inlist(accwfrent`i',0) & inlist(accwfother`i',0) & inlist(acchdira`i',0) & inlist(accwfann`i',0) & inlist(accwfira`i',0) & inlist(accwfothpen`i',0) & inlist(accofumothwelf`i',0) // 
}	
*2015,2017
forv i=39/41 {		
  replace S_nonlab`var'`i'=1  if inlist(accofummisctr`i',0)  & inlist(acctrustwf`i',0) & inlist(accintwf`i',0) & inlist(accdivwf`i',0) & inlist(accalimhd`i',0) & inlist(acctrusthd`i',0) & inlist(accinthd`i',0) & inlist(accdividhd`i',0) & inlist(accrenthd`i',0) & inlist(acctnsfmiscwf`i',0) & inlist(acchlpnonrelwf`i',0) & inlist(acchlprelwf`i',0) & inlist(accpenswf`i',0) & inlist(accsswf`i',0) & inlist(accothwelwf`i',0) & inlist(accchsuppwf`i',0) & inlist(accssiwf`i',0) & inlist(accwrkcomwf`i',0) & inlist(accunempwf`i',0) & inlist(acctnsfmischd`i',0)  & inlist(acchlprelhd`i',0) & inlist(accchsupphd`i',0) & inlist(accwrkcomhd`i',0) & inlist(accunemphd`i',0) & inlist(accotrethd`i',0) & inlist(accirahd`i',0) & inlist(accpenshd`i',0) & inlist(accvapenshd`i',0) & inlist(accsshd`i',0) & 	 inlist(accothwelhd`i',0) & inlist(accssihd`i',0)  & inlist(accssiofum`i',0) & inlist(accofumss`i',0) & inlist(accofumva`i',0) & inlist(accofumret`i',0) & inlist(accofumunemp`i',0) & inlist(accofumwrkcmp`i',0) & inlist(accofumchsupp`i',0) & inlist(accofumhlprel`i',0) & inlist(accadchdin`i',0) & inlist(accadcwfin`i',0) & inlist(acchdhlelse`i',0) & inlist(accwfrent`i',0) & inlist(accwfother`i',0) & inlist(acchdira`i',0) & inlist(accwfann`i',0) & inlist(accwfira`i',0) & inlist(accwfothpen`i',0) & inlist(accofumothwelf`i',0) & inlist(accspalim`i',0) & inlist(accspva`i',0)  	
}
} // end NON-LABOR INCOME
 

 


*** Hours

*1968-1984 surveys 
*0=no assignments; 1=minor assignments; 2=major assignment; (In some years: 3=estimate not an accurate reflection of income or payments in 1967)
forv i=1/17 {
  replace S_hours`var'hd`i'=1 if inlist(acchourshdin`i',0,1) & inlist(acchrsmainhdin`i',0,1) & inlist(acchrsxtrahdin`i',0,1) 
  replace S_hours`var'wf`i'=1 if inlist(acchourswfin`i',0,1) & inlist(acchrsmainwfin`i',0,1) & inlist(acchrsxtrawfin`i',0,1) 	
}
*1985-1992 surveys
*0=no assignments; 1=minor assignments; 2=major assignment;  
forv i=18/25 {
  replace S_hours`var'hd`i'=1 if inlist(acchrsoverhdin`i',0,1) & inlist(acchrsmainhdin`i',0,1) & inlist(acchrsxtrahdin`i',0,1) 
  replace S_hours`var'wf`i'=1 if inlist(acchrsoverwfin`i',0,1) & inlist(acchrsmainwfin`i',0,1) & inlist(acchrsxtrawfin`i',0,1) 	
}
*1993 survey
*0=no assignments; 1=imputed
forv i=26/26 {
  replace S_hours`var'hd`i'=1 if inlist(acchrsoverhdin`i',0) & inlist(acchrsmainhdin`i',0) & inlist(acchrsxtrahdin`i',0) 
  replace S_hours`var'wf`i'=1 if inlist(acchrsoverwfin`i',0) & inlist(acchrsmainwfin`i',0) & inlist(acchrsxtrawfin`i',0) 	
}
*1994-2007 surveys -- NO ACCURACY VARIABLES FOR HOURS
forv i=27/35 {
  replace S_hours`var'hd`i'=1 
  replace S_hours`var'wf`i'=1 
}
*2009-2017
*(0=No assignment, 1=Imputed by PSID staff during data cleaning and editing, 2=Imputed from other info in this interview, 3=Imputed from last wave's report for this case, 4=Imputed from subgroup means, 5=Imputed using median value for all non-zero cases)
forv i=36/41 {
  replace S_hours`var'hd`i'=1 if inlist(acchrsoverhdin`i',0,1,2,3) & inlist(accweekswrkhdin`i',0,1,2,3) & inlist(accworkhrshdin`i',0,1,2,3) 
  replace S_hours`var'wf`i'=1 if inlist(acchrsoverwfin`i',0,1,2,3) & inlist(accweekswrkwfin`i',0,1,2,3) & inlist(accworkhrswfin`i',0,1,2,3) 	
}


